﻿using System;

namespace Terraria.World.Generation
{
	// Token: 0x02000090 RID: 144
	public class GenerationProgress
	{
		// Token: 0x170000BF RID: 191
		// (get) Token: 0x06000A28 RID: 2600 RVA: 0x0000AF37 File Offset: 0x00009137
		// (set) Token: 0x06000A29 RID: 2601 RVA: 0x0000AF4F File Offset: 0x0000914F
		public string Message
		{
			get
			{
				return string.Format(this._message, this.Value);
			}
			set
			{
				this._message = value.Replace("%", "{0:0.0%}");
			}
		}

		// Token: 0x170000C0 RID: 192
		// (get) Token: 0x06000A2A RID: 2602 RVA: 0x0000AF67 File Offset: 0x00009167
		// (set) Token: 0x06000A2B RID: 2603 RVA: 0x0000AF6F File Offset: 0x0000916F
		public float Value
		{
			get
			{
				return this._value;
			}
			set
			{
				this._value = Utils.Clamp<float>(value, 0f, 1f);
			}
		}

		// Token: 0x170000C1 RID: 193
		// (get) Token: 0x06000A2C RID: 2604 RVA: 0x0000AF87 File Offset: 0x00009187
		public float TotalProgress
		{
			get
			{
				if (this.TotalWeight == 0f)
				{
					return 0f;
				}
				return (this.Value * this.CurrentPassWeight + this._totalProgress) / this.TotalWeight;
			}
		}

		// Token: 0x06000A2D RID: 2605 RVA: 0x0000AFB7 File Offset: 0x000091B7
		public void Set(float value)
		{
			this.Value = value;
		}

		// Token: 0x06000A2E RID: 2606 RVA: 0x0000AFC0 File Offset: 0x000091C0
		public void Start(float weight)
		{
			this.CurrentPassWeight = weight;
			this._value = 0f;
		}

		// Token: 0x06000A2F RID: 2607 RVA: 0x0000AFD4 File Offset: 0x000091D4
		public void End()
		{
			this._totalProgress += this.CurrentPassWeight;
		}

		// Token: 0x04000EAF RID: 3759
		private string _message = "";

		// Token: 0x04000EB0 RID: 3760
		private float _value;

		// Token: 0x04000EB1 RID: 3761
		private float _totalProgress;

		// Token: 0x04000EB2 RID: 3762
		public float TotalWeight;

		// Token: 0x04000EB3 RID: 3763
		public float CurrentPassWeight = 1f;
	}
}
